package uk.co.agileworks.bidpirate.web;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import uk.co.agileworks.bidpirate.service.BusinessLogic;
import uk.co.agileworks.bidpirate.service.EbayFacade;

@Component
public class ControllerHelper {

	protected static final Logger LOGGER = LoggerFactory.getLogger(ControllerHelper.class);
	
	@Autowired
	private BusinessLogic businessLogic;

	@Autowired
	private EbayFacade ebayFacade;

	@Autowired
	private UserSession userSession;

	@Resource
	private String openItemUrl;

	public final BusinessLogic getBusinessLogic() {
		return businessLogic;
	}

	public final EbayFacade getEbayFacade() {
		return ebayFacade;
	}

	public final String getOpenItemUrl() {
		return openItemUrl.replace("%EBAY_HOME%", userSession.getUser().getRegion().getEbayHome());
	}

	public final UserSession getUserSession() {
		return userSession;
	}

}
